import asyncio

@asyncio.coroutine
def fun1():
    print(1)
    yield from asyncio.sleep(2)
    print(2)

@asyncio.coroutine
def fun2():
    print(21)
    yield from asyncio.sleep(2)
    print(22)


@asyncio.coroutine
def fun3():
    print(31)
    print(32)

if __name__ == "__main__":
  tasks = [
    asyncio.ensure_future(fun1()),
    asyncio.ensure_future(fun2())
    # asyncio.ensure_future(fun3()),
  ]
  loop = asyncio.get_event_loop()
  loop.run_until_complete(asyncio.wait(tasks))